<template>
	<view class="page">
		<z-paging ref="paging" v-model="dataList" @query="queryList">
			<uv-navbar slot="top" autoBack :fixed="true" title="案例中心" placeholder></uv-navbar>

			<!-- 内容 -->
			<view class="contnet ios">
				<view class="case-item" v-for="(item, idx) in dataList" :key="idx" @click="jump(item.id)">
					<image class="case-img" :src="item.admin_case_list[0].file_url" mode="aspectFill"></image>
					<view class="case-right">
						<view>
							<view class="case-title">{{item.title}}</view>
							<view class="case-tag"><span :style="{color: item.brand_colour}">{{item.brand_name}}</span></view>
						</view>
						<view class="case-author-box">{{item.created_at}}</view>
					</view>
				</view>
			</view>

			<image slot="empty" class="no-data" src="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
				mode="widthFix"></image>
		</z-paging>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
			}
		},
		methods: {
			jump(id) {
				uni.navigateTo({
					url: '/pages/case/case_info?id=' + id
				});
			},
			queryList(page, num) {
				this.getList(page, num);
			},
			getList(page, num) {
				this.$Api.wxHomepageData({
					type: 2,
					page: 1,
					num: 10
				}).then((res) => {
					console.log(res, '小程序配置数据-type3');
					if (res.code == 200) {
						this.$refs.paging.complete(res.data.list);
					} else {
						this.$refs.paging.complete([]);
					}
					this.loading = false;
				}).catch((err) => {
					setTimeout(() => {
						// 停止刷新动画
						this.$refs.paging.complete();
						this.loading = false;
					}, 300);
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "list.scss";
</style>